---
title: "Vercel Deployer"
description: "Documentation for the VercelDeployer class, which deploys Kastrax applications to Vercel."
---

# VercelDeployer ✅

The VercelDeployer deploys Kastrax applications to Vercel, handling configuration, environment variable synchronization, and deployment processes. It extends the abstract Deployer class to provide Vercel-specific deployment functionality.

## Usage Example ✅

```typescript
import { Kastrax } from '@kastrax/core';
import { VercelDeployer } from '@kastrax/deployer-vercel';

const kastrax = new Kastrax({
  deployer: new VercelDeployer({
    teamSlug: 'your-team-slug',
    projectName: 'your-project-name',
    token: 'your-vercel-token'
  }),
  // ... other Kastrax configuration options
});
```

## Parameters ✅

### Constructor Parameters

<PropertiesTable
  content={[
    {
      name: "teamSlug",
      type: "string",
      description: "Your Vercel team slug",
      isOptional: false,
    },
    {
      name: "projectName",
      type: "string",
      description: "Name of your Vercel project (will be created if it doesn't exist).",
      isOptional: false,
    },
    {
      name: "token",
      type: "string",
      description: "Your Vercel authentication token.",
      isOptional: false,
    },
  ]}
/>


### Environment Variables

The VercelDeployer handles environment variables from multiple sources:

1. **Environment Files**: Variables from `.env.production` and `.env` files.
2. **Configuration**: Variables passed through the Kastrax configuration.
3. **Vercel Dashboard**: Variables can also be managed through Vercel's web interface.

The deployer automatically synchronizes environment variables between your local development environment and Vercel's environment variable system, ensuring consistency across all deployment environments (production, preview, and development).

## Build Kastrax Project ✅

To build your Kastrax project for Vercel deployment:

```bash
npx kastrax build
```

The build process generates the following output structure in the `.kastrax/output` directory:

```
.kastrax/output/
├── vercel.json     # Vercel configuration
└── index.mjs       # Application entry point
```

### Vercel Configuration

The VercelDeployer automatically generates a `vercel.json` configuration file in `.kastrax/output` with the following settings:

```json
{
  "version": 2,
  "installCommand": "npm install --omit=dev",
  "builds": [
    {
      "src": "index.mjs",
      "use": "@vercel/node",
      "config": {
        "includeFiles": ["**"]
      }
    }
  ],
  "routes": [
    {
      "src": "/(.*)",
      "dest": "index.mjs"
    }
  ]
}
```

## Deployment Options ✅

After building, you can deploy your Kastrax application `.kastrax/output` to Vercel using any of these methods:

1. **Vercel CLI**: Deploy directly using Vercel's official CLI tool
   - Install the CLI: `npm install -g vercel`
   - Navigate to the output directory: `cd .kastrax/output`
   - Deploy to preview environment: `vercel`
   - For production deployment: `vercel --prod`

2. **Vercel Dashboard**: Connect your Git repository or drag-and-drop the build output through the Vercel dashboard

> You can also run `vercel dev` in your output directory `.kastrax/output` to test your Kastrax application locally.

## Platform Documentation ✅

- [Vercel](https://vercel.com/docs)